

class Solution(object):
    def singleNumber(self, nums):
        """
        :type nums: List[int]
        :rtype: int
        """
        # i = 0
        # for a in nums:
        #     print(a)
        #     del nums[i]
        #     print(nums)
        #     i += 1
        #     if a not in nums:
        #         print(a)
        tot = len(nums)
        new = []
        for i in range(tot):
            last = nums.pop()
            if last not in nums and last not in new:
                print(last)
                return last
            if last in nums or last in new:
                new.append(last)


if __name__ == '__main__':
    sol = Solution()
    sol.singleNumber([2, 2, 1])
